package de.fhb.itunes.manager.mail;



import javax.mail.MessagingException;

import de.fhb.itunes.manager.mail.Template.Template;



public class Mail {
	private String content;
	private String subject;
	private MailContentBuilder mcb;
	

	public Mail() {
		this.mcb = new MailContentBuilder();
		
		this.subject = "Neue Daten für die iTunes Mediathek";
	}

	public Mail(String subject) {
		this();
		this.subject = subject;
	}

	public boolean send() {
		try {
			MailSender mailsender = new MailSender();
			
			
			
			this.content = mcb.getEmail();
			mailsender.send(this.content, this.subject);
		} catch (MessagingException e) {
			System.out.println("Mail konnte nicht versendet werden!!!");
			e.printStackTrace();
		}
		return true;
	}

	
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	public void addTemplate(Template template) {
		mcb.addTemplate(template);
	}
	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}
	
}
